<template>
	<view>
		<view class="write_id">
			<input type="text"
			v-model="UID"
			placeholder="请输入ID" placeholder-class="place"/>
		</view>
		<view class="login_btn" @tap="tologin">
			登录
		</view>
	</view>
</template>

<script>
	import {uidLogin} from '@/common/index.js'
	export default {
		data () {
			return {
				UID: ''
			}
		},
		created() {
			// if(uni.getStorageSync('token')){
			// 	uni.switchTab({
			// 		url: '/pages/index/index'
			// 	})
			// }
		},
		methods: {
			tologin () {
				uidLogin({uid: this.UID}).then(res=>{
					if(res.code == 1) {
						// uni.setStorageSync('token',res.msg)
						uni.switchTab({
							url: '/pages/index/index'
						})
					}else {
						this.toast(res.msg)
					}
				})
				// this.ajax('login/loginDo', {
				// 	data: {
				// 		uid: this.UID
				// 	},
				// 	success: res => {
						
				// 	}
				// })
			}
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
		overflow: hidden;
	}
</style>
<style lang="less" scoped>
	.write_id {
		width: 600upx;
		height: 80upx;
		border: 2upx solid #f0f0f0;
		margin: auto;
		margin-top: 300upx;
		border-radius: 8upx;
		input {
			width: 100%;
			height: 100%;
			padding-left: 30upx;
		}
	}
	.login_btn {
		width: 600upx;
		height: 80upx;
		border-radius: 8upx;
		text-align: center;
		line-height: 80upx;
		background-color: #8938d3;
		margin: 40upx auto;
		color: #FFFFFF;
		font-size: 32upx;
	}
</style>
